using B.S.NewMedical.ErrorCode;
using MediatR;

namespace B.S.NewMedical.Api.Write.Application.Command.User
{
    /// <summary>
    /// 获取权限树命令
    /// </summary>
    public class GetPermissionTreeCommand : IRequest<ApiResult<List<PermissionTreeDto>>>
    {
        /// <summary>
        /// 用户ID（可选，用于获取用户特定权限）
        /// </summary>
        public int? UserId { get; set; }
    }

    /// <summary>
    /// 权限树DTO
    /// </summary>
    public class PermissionTreeDto
    {
        /// <summary>
        /// 模块名称
        /// </summary>
        public required string ModuleName { get; set; }

        /// <summary>
        /// 模块代码
        /// </summary>
        public required string ModuleCode { get; set; }

        /// <summary>
        /// 是否选中
        /// </summary>
        public bool IsChecked { get; set; }

        /// <summary>
        /// 子权限列表
        /// </summary>
        public List<PermissionItemDto> Permissions { get; set; } = new();
    }

    /// <summary>
    /// 权限项DTO
    /// </summary>
    public class PermissionItemDto
    {
        /// <summary>
        /// 权限ID
        /// </summary>
        public int PermissionId { get; set; }

        /// <summary>
        /// 权限名称
        /// </summary>
        public required string PermissionName { get; set; }

        /// <summary>
        /// 权限代码
        /// </summary>
        public required string PermissionCode { get; set; }

        /// <summary>
        /// 是否选中
        /// </summary>
        public bool IsChecked { get; set; }
    }
} 